# -*- coding: utf-8 -*-
import maya.cmds as cmds
import maya.mel as mel
class Check_MergeAnim_layers():
	def Check_MergeAnim_layers(self):
		layers_str = ''
		anim_layers = cmds.ls(type="animLayer")
		try:
			if anim_layers:
				for i in anim_layers:
					layers_str += '"' + i + '",'
				mel.eval("string $layers[]=" + "{" + layers_str[:-1] + "}" + ';')#layerEditorMergeAnimLayer($layers,0);
				mel.eval("global string $gSelectedAnimLayers[];$gSelectedAnimLayers = $layers;")
				mel.eval("performAnimLayerMerge( 0 );")
				cmds.delete(cmds.ls(type="animLayer"))
			anim_layers = cmds.ls(type="animLayer")
			if not anim_layers:
				return("YES")
		except:
			return("NO")